package com.jxdinfo.hussar.cloud.module.example.dljc.basketnotice.controller;

import com.jxdinfo.hussar.cloud.module.example.dljc.basketnotice.model.BasketNotice;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketnotice.service.BasketNoticeService;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketnotice.vo.BasketNoticePageVO;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketnotice.vo.BasketNoticeSearchVO;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketnotice.vo.BasketNoticeVO;
import com.jxdinfo.hussar.platform.core.base.apiresult.ApiResponse;
import com.jxdinfo.hussar.support.audit.core.annotations.AuditLog;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventGrade;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventType;
import com.jxdinfo.hussar.support.mp.base.controller.HussarBaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 吊篮异常通知控制器
 */
@RestController(value = "dljc.basketnotice.BasketNoticeController")
@AuditLog(moduleName = "吊篮异常通知")
@RequestMapping(value = "/dljc/basketNotice")
public class BasketNoticeController extends HussarBaseController<BasketNotice, BasketNoticeService> {

    private static final Logger logger = LoggerFactory.getLogger(BasketNoticeController.class);

    @Autowired
    private BasketNoticeService basketNoticeService;

    /**
     * 分页查询吊篮异常通知
     *
     * @param basketNoticeSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮异常通知", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("findByPage")
    public ApiResponse<BasketNoticePageVO> findByPage(@RequestBody BasketNoticeSearchVO basketNoticeSearchVO) {
        //todo 没有获取项目编号工具类
        return basketNoticeService.findByPage(basketNoticeSearchVO);
    }

    /**
     * 吊篮异常通知条件查询
     *
     * @param basketNoticeSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮异常通知", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("findByList")
    public ApiResponse<List<BasketNoticeVO>> findByList(@RequestBody BasketNoticeSearchVO basketNoticeSearchVO) {
        //todo 没有获取项目编号工具类
        return basketNoticeService.findByList(basketNoticeSearchVO);
    }

    /**
     * 吊篮异常通知新增
     *
     * @param basketNoticeSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮异常通知", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("add")
    public ApiResponse<String> add(@RequestBody BasketNoticeSearchVO basketNoticeSearchVO) {
        //todo 没有获取项目编号工具类
        return basketNoticeService.add(basketNoticeSearchVO);
    }

    /**
     * 吊篮异常通知修改
     *
     * @param basketNoticeSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮异常通知", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("update")
    public ApiResponse<String> update(@RequestBody BasketNoticeSearchVO basketNoticeSearchVO) {
        //todo 没有获取项目编号工具类
        return basketNoticeService.updateTowerNotice(basketNoticeSearchVO);
    }

    /**
     * 吊篮异常通知删除
     *
     * @param basketNoticeSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮异常通知", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("deleteById")
    public ApiResponse<String> deleteById(@RequestBody BasketNoticeSearchVO basketNoticeSearchVO) {
        //todo 没有获取项目编号工具类
        return basketNoticeService.deleteById(basketNoticeSearchVO);
    }
}
